
localStorage.getItem('id')
localStorage.getItem('number')

let Id = localStorage.getItem('id')
let Number = localStorage.getItem('number')
console.log(Id)

let Id2 = JSON.parse(Id)
let Number2 = JSON.parse(Number)

console.log(JSON.parse(Number));
console.log($(".left input[type='text']").val(Number2.p_number));

console.log($("select[name='data']").val(Number2.p_data));
$(".left input[type='text']").val(Number2.p_number)
$("select[name='data']").val(Number2.p_data)
$(".left input[type='precision']").val(Number2.p_precision)
$("select[name='type']").val(Number2.p_type)
$("#note").val(Number2.p_note)
$(".right input[type='text2']").val(Number2.p_project)
$("select[name='state']").val(Number2.p_state)
$(".right input[type='length']").val(Number2.p_length)
$(".right input[type='founder']").val(Number2.p_founder)
$(".founderTime input[type='date']").val(Number2.p_founderTime)
$(".right input[type='updata']").val(Number2.p_update)
// $(".updataTime input[type='date']").val(Number2.p_updateTime)
$('#modify').click(() => {
    console.log($(".left input[type='text']").val(),)
    console.log($(".updataTime input[type='date']").val());
    if (confirm("确定修改这条数据吗？")) {
        $.ajax({
            url: '/salary/modify',
            method: 'post',
            data: {
                number: $(".left input[type='text']").val(),
                data: $("select[name='data']").val(),
                precision: $(".left input[type='precision']").val(),
                type: $("select[name='type']").val(),
                note: $("#note").val(),
                project: $(".right input[type='text2']").val(),
                state: $("select[name='state']").val(),
                length: $(".right input[type='length']").val(),
                founder: $(".right input[type='founder']").val(),
                founderTime: $(".founderTime input[type='date']").val(),
                updata: $(".right input[type='updata']").val(),
                updataTime: $(".updataTime input[type='date']").val()
            },
            success: (res) => {
                console.log(res)
                alert('修改成功')
            }
        })
    }
})
// 返回
$('#reset').click(() => {
    $(".left input[type='text']").val(Number2.p_number)
    $("select[name='data']").val(Number2.p_data)
    $(".left input[type='precision']").val(Number2.p_precision)
    $("select[name='type']").val(Number2.p_type)
    $("#note").val(Number2.p_note)
    $(".right input[type='text2']").val(Number2.p_project)
    $("select[name='state']").val(Number2.p_state)
    $(".right input[type='length']").val(Number2.p_length)
    $(".right input[type='founder']").val(Number2.p_founder)
    $(".founderTime input[type='date']").val(Number2.p_founderTime)
    $(".right input[type='updata']").val(Number2.p_update)
    location.href="../../pages/xinchouFuLi--Heyinhua/xinzixiangmu.html"
})

